package com.oop.Movie;

import java.util.Scanner;

/*
要写注释哦!!!
*/
public class Test {
    public static void main(String[] args) {
        Movie[] movies = new Movie[5];
        movies[0] = new Movie("出拳吧，妈妈", 7.9, 1.2, "唐晓白", "谭卓", "致敬女性力量");
        movies[1] = new Movie("一点就到家", 8.7, 1.2, "唐晓白", "谭卓", "致敬女性力量");
        movies[2] = new Movie("月球陨落", 7.9, 1.2, "唐晓白", "谭卓", "致敬女性力量");
        movies[3] = new Movie("小美人鱼的奇幻冒险", 7.9, 1.2, "唐晓白", "谭卓", "致敬女性力量");
        movies[4] = new Movie("长津湖只水门桥", 9.6, 1.2, "唐晓白", "谭卓", "致敬女性力量");
        //遍历所有的电影数据
        for (int i = 0; i < movies.length; i++) {
            System.out.println("名字：" + movies[i].getName());
            System.out.println("评分：" + movies[i].getRate());
            System.out.println(movies[i].getWantWatch() + "万人想看");
            System.out.println("导演：" + movies[i].getLeader());
            System.out.println("主演：" + movies[i].getActor());
            System.out.println("点评：" + movies[i].getLable());
            System.out.println("========================");
        }

        //根据名字查询电影
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要查询的电影名字：");
        String movieName = sc.next();
        for (int i = 0; i < movies.length; i++) {
            Movie movie = movies[i];
            if (movieName==movie.getName()) {
                System.out.println("名字：" + movie.getName());
                System.out.println("评分：" + movie.getRate());
                System.out.println(movie.getWantWatch() + "万人想看");
                System.out.println("导演：" + movie.getLeader());
                System.out.println("主演：" + movie.getActor());
                System.out.println("点评：" + movie.getLable());
            } else {
                System.out.println("你查询的" + movieName + "不存在！");
                break;
            }
        }
    }
}
